<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>时光桥梁后台管理系统</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <%--<link rel="shortcut icon" href="${pageContext.request.contextPath}/font/favicon.ico" type="image/x-icon"/>--%>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/lib/layui/css/layui.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/main/font.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/main/xadmin.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/swiper.min.css">
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/login/jquery.min.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/swiper.jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/js/main/xadmin.js"></script>

</head>
<body>
<form class="layui-form">
    <div class="layui-form-item">
        <label for="username" class="layui-form-label">
            <span class="x-red">*</span>用户名
        </label>
        <div class="layui-input-inline">
            <input type="text" id="username" name="username" required="" lay-verify="required"
                   autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">
            <span class="x-red">*</span>将会成为您唯一的登入名
        </div>
    </div>
    <div class="layui-form-item">
        <label for="password" class="layui-form-label">
            <span class="x-red">*</span>密码
        </label>
        <div class="layui-input-inline">
            <input type="password" id="password" name="password" required="" lay-verify="required"
                   autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="phone" class="layui-form-label">
            <span class="x-red">*</span>手机号码
        </label>
        <div class="layui-input-inline">
            <input type="text" id="phone" name="phone" required="" lay-verify="required"
                   autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label for="add" class="layui-form-label">
        </label>
        <input type="button" value="保存" id="add" class="layui-btn" lay-filter="save" lay-submit="">

        </input>
    </div>
</form>
<script>
    //百度统计可去掉
    var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>
</body>
<script type="text/javascript">
    $("#add").click(function () {
        $.ajax({
            type: "post",
            url: "${pageContext.request.contextPath}/addRole.do",
            data: {
                username: $("#username").val(),
                password: $("#password").val(),
                phone: $("#phone").val()
            },
            success: function (s) {
                if (s.success) {
                    alert(s.msg);
                    <%--window.location.href = "${pageContext.request.contextPath}/role.do";--%>
                    x_admin_close();
                } else {
                    alert(s.msg);
                }
            }
        })
    });
</script>
</html>